package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/11/11 21:57
 **/
public class Day67_1_Num1706_HalvesAreAlike {
    class Solution {
        public boolean halvesAreAlike(String s) {
            String a = s.substring(0, s.length() / 2);
            String b = s.substring(s.length() / 2);
            String h = "aeiouAEIOU";
            int sum1 = 0, sum2 = 0;
            for (int i = 0; i < a.length(); i++) {
                if (h.indexOf(a.charAt(i)) >= 0) {
                    sum1++;
                }
            }
            for (int i = 0; i < b.length(); i++) {
                if (h.indexOf(b.charAt(i)) >= 0) {
                    sum2++;
                }
            }
            return sum1 == sum2;
        }
    }
}